package com.onlyxiahui.of.muc.listener;

import org.jivesoftware.openfire.muc.MUCEventListener;
import org.xmpp.packet.JID;
import org.xmpp.packet.Message;

import com.onlyxiahui.of.muc.service.RoomService;

public class MUCEventListenerImpl implements MUCEventListener {

	@Override
	public void roomCreated(JID roomJID) {
		//System.out.println("MUCEventListenerImpl.roomCreated:" + roomJID);
		//System.out.println(roomJID.getNode());
	}

	@Override
	public void roomDestroyed(JID roomJID) {
		// TODO Auto-generated method stub

	}

	@Override
	public void occupantJoined(JID roomJID, JID user, String nickname) {
		RoomService.saveUser(roomJID, user, nickname);
		//System.out.println("MUCEventListenerImpl.occupantJoined:" + user);
	}

	@Override
	public void occupantLeft(JID roomJID, JID user) {
		// RoomService.removeUser(roomJID, user);
		//System.out.println("MUCEventListenerImpl.occupantLeft:" + user);
	}

	@Override
	public void nicknameChanged(JID roomJID, JID user, String oldNickname, String newNickname) {
		// TODO Auto-generated method stub
		RoomService.updateNickname(roomJID, user, oldNickname, newNickname);
	}

	@Override
	public void messageReceived(JID roomJID, JID user, String nickname, Message message) {
		// TODO Auto-generated method stub

	}

	@Override
	public void privateMessageRecieved(JID toJID, JID fromJID, Message message) {
		// TODO Auto-generated method stub

	}

	@Override
	public void roomSubjectChanged(JID roomJID, JID user, String newSubject) {
		// TODO Auto-generated method stub

	}

}
